home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / dpingw / dpingw.exe / DPing.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-03-30  |  8.0 KB  |  256 lines

  1. VERSION 5.00
  2. Object = "{DAA0D7B7-6667-11D1-9A13-00C04FD8DC2E}#1.0#0"; "DPing.dll"
  3. Begin VB.Form Form1 
  4.    BackColor       =   &H00C0C0C0&
  5.    Caption         =   "DameWare Ping Sample"
  6.    ClientHeight    =   4980
  7.    ClientLeft      =   930
  8.    ClientTop       =   1050
  9.    ClientWidth     =   8040
  10.    FillColor       =   &H00404040&
  11.    FillStyle       =   0  'Solid
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   4980
  14.    ScaleWidth      =   8040
  15.    StartUpPosition =   2  'CenterScreen
  16.    Begin VB.CheckBox Check3 
  17.       Caption         =   "Use Pre-Formatted"
  18.       Height          =   255
  19.       Left            =   3480
  20.       TabIndex        =   9
  21.       Top             =   1200
  22.       Width           =   2175
  23.    End
  24.    Begin VB.Timer Timer1 
  25.       Left            =   6720
  26.       Top             =   240
  27.    End
  28.    Begin VB.CommandButton Command2 
  29.       Caption         =   "Stop"
  30.       Enabled         =   0   'False
  31.       Height          =   375
  32.       Left            =   6600
  33.       TabIndex        =   2
  34.       Top             =   2040
  35.       Width           =   1335
  36.    End
  37.    Begin VB.TextBox Text6 
  38.       Height          =   375
  39.       Left            =   4080
  40.       TabIndex        =   0
  41.       Text            =   "yahoo.com"
  42.       Top             =   2520
  43.       Width           =   2175
  44.    End
  45.    Begin VB.TextBox Text5 
  46.       Alignment       =   1  'Right Justify
  47.       Height          =   375
  48.       Left            =   120
  49.       TabIndex        =   6
  50.       Text            =   "60"
  51.       Top             =   2520
  52.       Width           =   735
  53.    End
  54.    Begin VB.TextBox Text4 
  55.       Alignment       =   1  'Right Justify
  56.       Height          =   375
  57.       Left            =   120
  58.       TabIndex        =   5
  59.       Text            =   "1000"
  60.       Top             =   1800
  61.       Width           =   735
  62.    End
  63.    Begin VB.TextBox Text3 
  64.       Alignment       =   1  'Right Justify
  65.       Height          =   375
  66.       Left            =   120
  67.       TabIndex        =   4
  68.       Text            =   "32"
  69.       Top             =   1080
  70.       Width           =   735
  71.    End
  72.    Begin VB.CheckBox Check2 
  73.       Caption         =   "Resolve addresses to hostnames."
  74.       Height          =   375
  75.       Left            =   3480
  76.       TabIndex        =   8
  77.       Top             =   720
  78.       Width           =   2175
  79.    End
  80.    Begin VB.CheckBox Check1 
  81.       Caption         =   "Ping the specifed host until interrupted."
  82.       Height          =   375
  83.       Left            =   3480
  84.       TabIndex        =   7
  85.       Top             =   240
  86.       Width           =   2295
  87.    End
  88.    Begin VB.TextBox Text2 
  89.       Alignment       =   1  'Right Justify
  90.       Height          =   375
  91.       Left            =   120
  92.       TabIndex        =   3
  93.       Text            =   "4"
  94.       Top             =   360
  95.       Width           =   735
  96.    End
  97.    Begin VB.TextBox Text1 
  98.       BeginProperty Font 
  99.          Name            =   "Courier"
  100.          Size            =   9.75
  101.          Charset         =   0
  102.          Weight          =   400
  103.          Underline       =   0   'False
  104.          Italic          =   0   'False
  105.          Strikethrough   =   0   'False
  106.       EndProperty
  107.       Height          =   1935
  108.       Left            =   120
  109.       MultiLine       =   -1  'True
  110.       ScrollBars      =   2  'Vertical
  111.       TabIndex        =   11
  112.       Top             =   3000
  113.       Width           =   7815
  114.    End
  115.    Begin VB.CommandButton Command1 
  116.       Caption         =   "Ping"
  117.       Default         =   -1  'True
  118.       Height          =   375
  119.       Left            =   6600
  120.       TabIndex        =   1
  121.       Top             =   2520
  122.       Width           =   1335
  123.    End
  124.    Begin DPINGLibCtl.DPingCtl DPingCtl1 
  125.       Height          =   480
  126.       Left            =   7320
  127.       TabIndex        =   10
  128.       TabStop         =   0   'False
  129.       Top             =   240
  130.       Width           =   480
  131.       PacketSize      =   32
  132.       TTL             =   60
  133.       Timeout         =   1000
  134.       Continues       =   0
  135.       PingCount       =   3
  136.       HostName        =   ""
  137.       ResolveAddress  =   0
  138.       IPAddress       =   ""
  139.       UseWindow       =   0
  140.       ScrollBar       =   1
  141.    End
  142.    Begin VB.Shape Shape1 
  143.       FillColor       =   &H0000FF00&
  144.       FillStyle       =   0  'Solid
  145.       Height          =   375
  146.       Left            =   6960
  147.       Shape           =   3  'Circle
  148.       Top             =   1560
  149.       Width           =   615
  150.    End
  151.    Begin VB.Label Label5 
  152.       Caption         =   "IP Address or Host Name to Ping"
  153.       Height          =   255
  154.       Left            =   4080
  155.       TabIndex        =   16
  156.       Top             =   2280
  157.       Width           =   2415
  158.    End
  159.    Begin VB.Label Label4 
  160.       Caption         =   "Time To Live."
  161.       Height          =   255
  162.       Left            =   120
  163.       TabIndex        =   15
  164.       Top             =   2280
  165.       Width           =   1575
  166.    End
  167.    Begin VB.Label Label3 
  168.       Caption         =   "Timeout in milliseconds to wait for each reply."
  169.       Height          =   255
  170.       Left            =   120
  171.       TabIndex        =   14
  172.       Top             =   1560
  173.       Width           =   3255
  174.    End
  175.    Begin VB.Label Label2 
  176.       Caption         =   "Send buffer size."
  177.       Height          =   255
  178.       Left            =   120
  179.       TabIndex        =   13
  180.       Top             =   840
  181.       Width           =   1455
  182.    End
  183.    Begin VB.Label Label1 
  184.       Caption         =   "Number of echo requests to send"
  185.       Height          =   255
  186.       Left            =   120
  187.       TabIndex        =   12
  188.       Top             =   120
  189.       Width           =   2535
  190.    End
  191. Attribute VB_Name = "Form1"
  192. Attribute VB_GlobalNameSpace = False
  193. Attribute VB_Creatable = False
  194. Attribute VB_PredeclaredId = True
  195. Attribute VB_Exposed = False
  196. Private Sub Command1_Click()
  197. Text1.Text = ""
  198. Shape1.FillColor = &HFF&
  199. Command1.Enabled = False
  200. DPingCtl1.ResolveAddress = Check2.Value
  201. DPingCtl1.Continuous = Check1.Value
  202. DPingCtl1.PingCount = CLng(Text2.Text)
  203. DPingCtl1.PacketSize = CLng(Text3.Text)
  204. DPingCtl1.TTL = CLng(Text5.Text)
  205. DPingCtl1.Timeout = CLng(Text4.Text)
  206. DPingCtl1.Ping Text6.Text
  207. If Check3.Value = 0 Then
  208.     If DPingCtl1.HostName = "" Then
  209.         Text1.Text = "Pinging " + Text6.Text + " with " + Text3.Text + "bytes of data:" + Chr(13) + Chr(10) + Chr(13) + Chr(10)
  210.     Else
  211.         Text1.Text = "Pinging " + DPingCtl1.HostName + " [" + DPingCtl1.IPAddress + "] " + "with " + Text3.Text + "bytes of data:" + Chr(13) + Chr(10) + Chr(13) + Chr(10)
  212.     End If
  213. End If
  214. Timer1.Interval = 100
  215. End Sub
  216. Private Sub Command2_Click()
  217. DPingCtl1.IsRunning = False
  218. End Sub
  219. Private Sub DPingCtl1_OnPing(ByVal strIpAddress As String, ByVal lBytes As Long, ByVal lTime As Long, ByVal lTTL As Long)
  220. If Check3.Value = 0 Then
  221.     If lTime < 10 Then
  222.         StrTime$ = " time<10"
  223.     Else
  224.         StrTime$ = " time=" + LTrim(Str(lTime))
  225.     End If
  226.     If lBytes = -1 Then
  227.         Text1.Text = Text1.Text + "Request timed out." + Chr(13) + Chr(10)
  228.     Else
  229.         Text1.Text = Text1.Text + "Reply from " + strIpAddress + ": bytes=" + LTrim(Str(lBytes)) + StrTime$ + " TTL=" + LTrim(Str(lTTL)) + Chr(13) + Chr(10)
  230.     End If
  231.     Text1.SelStart = Len(Text1.Text)
  232.     Text1.SelLength = 0
  233. End If
  234. End Sub
  235. Private Sub DPingCtl1_OnPingError(ByVal strError As String, ByVal lError As Long)
  236.     Text1.Text = Text1.Text + strError
  237.     Text1.SelStart = Len(Text1.Text)
  238.     Text1.SelLength = 0
  239. End Sub
  240. Private Sub DPingCtl1_OnPingStr(ByVal strPing As String)
  241. If Check3.Value = 1 Then
  242.     Text1.Text = Text1.Text + strPing
  243.     Text1.SelStart = Len(Text1.Text)
  244.     Text1.SelLength = 0
  245. End If
  246. End Sub
  247. Private Sub Timer1_Timer()
  248. If DPingCtl1.IsRunning Then
  249.     Shape1.FillColor = &HFF&
  250.     Command2.Enabled = True
  251.     Shape1.FillColor = &HFF00&
  252.     Command2.Enabled = False
  253.     Command1.Enabled = True
  254. End If
  255. End Sub
  256.